package com.wtf.dsp.admin.exception;

import com.wtf.dsp.admin.enums.CommonErrorEnum;

/**
 * ClassName: WtfDspException
 * Description:
 * date: 2024/3/6 10:15
 *
 * @author linhuanyou
 * @version 1.0
 */
public class WtfDspException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private int errCode = 500;

    private String errMsg;

    public WtfDspException(String msg) {
        super(msg);
        this.errMsg = msg;
    }

    public WtfDspException(CommonErrorEnum commonErrorEnum) {
        super(commonErrorEnum.getErrMsg());
        this.errCode = commonErrorEnum.getErrCode();
        this.errMsg = commonErrorEnum.getErrMsg();
    }

    public WtfDspException(CommonErrorEnum commonErrorEnum, Throwable cause) {
        super(commonErrorEnum.getErrMsg(),cause);
        this.errCode = commonErrorEnum.getErrCode();
        this.errMsg = commonErrorEnum.getErrMsg();
    }

    public WtfDspException(int code,String msg) {
        super(msg);
        this.errCode = code;
        this.errMsg = msg;
    }

    public WtfDspException(int code,String msg, Throwable cause) {
        super(msg, cause);
        this.errCode = code;
        this.errMsg = msg;
    }

    public WtfDspException(String msg, Throwable cause) {
        super(msg, cause);
        this.errMsg = msg;
    }

    public WtfDspException(Throwable cause) {
        super(cause);
        this.errMsg = cause.getMessage();
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public int getErrCode() {
        return errCode;
    }

    public void setErrCode(int errCode) {
        this.errCode = errCode;
    }
}
